{% if (registry.has('theme_options') == constant('true')) %} 
     {% set theme_options = registry.get('theme_options') %}
     {% set config = registry.get('config') %}

     {{ '<div class="box today-deals-toys2 box-no-advanced">' }}
          {{ '<div class="box-heading">' }}
               {{ module['content']['title'] }}
          {{ '</div>' }}
          {{ '<div class="strip-line"></div>' }}
          {{ '<div class="box-content">' }}
               {{ '<div class="clearfix" style="clear: both"><div class="today-deals-toys2-products">' }}
 
               {% for product in module['content']['products'] %} 
                    
                    {% if (theme_options.get( 'display_specials_countdown' ) == '1' and product['special']) %} {% set countdown = random(50000)*random(50000) %} 
                         {% set product_detail = theme_options.getDataProduct( product['product_id'] ) %}
                         {% set date_end = product_detail['date_end'] %}
                         {% if (date_end != '0000-00-00' and date_end) %} 
                              <script>
                              $(function () {
                                   var austDay = new Date();
                                   austDay = new Date({{ theme_options.date("Y", theme_options.strtotime(date_end)) }}, {{ theme_options.date("m", theme_options.strtotime(date_end)) }} - 1, {{ theme_options.date("d", theme_options.strtotime(date_end)) }});
                                   $('#countdown{{ countdown }}').countdown({until: austDay});
                              });
                              </script>
                              <div id="countdown{{ countdown }}" class="clearfix"></div>
                         {% endif %} 
                    {% endif %} 
                    
                    <!-- Product -->
                    <div class="product clearfix product-hover">
                         <div class="left">
                              {% if (product['thumb']) %} 
                                   {% if (product['special'] and theme_options.get( 'display_text_sale' ) != '0') %} 
                                        {% set text_sale = 'Sale' %}
                                        {% if (theme_options.get( 'sale_text', config.get( 'config_language_id' ) ) != '') %}
                                             {% set text_sale = theme_options.get( 'sale_text', config.get( 'config_language_id' ) ) %}
                                        {% endif %} 
                                        {% if (theme_options.get( 'type_sale' ) == '1') %} 
                                             {% set product_detail = theme_options.getDataProduct( product['product_id'] ) %}
                                             {% set roznica_ceny = product_detail['price']-product_detail['special'] %}
                                             {% set procent = roznica_ceny*100/product_detail['price'] %} 
                                             <div class="sale">-{{ procent|round }}%</div>
                                        {% else %} 
                                             <div class="sale">{{ text_sale }}</div>
                                        {% endif %} 
                                    {% elseif (theme_options.get( 'display_text_new' ) != '0' and theme_options.isLatestProduct( product['product_id'] )) %} 
                                         <div class="new">{% if (theme_options.get( 'new_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'new_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'New' }} {% endif %}</div>
                                    {% endif %} 
                                   
                                   <div class="image {% if (theme_options.get( 'product_image_effect' ) == '1') %} {{ 'image-swap-effect' }} {% endif %}">
                                        <a href="{{ product['href'] }}">
                                             {% if (theme_options.get( 'product_image_effect' ) == '1') %}
                                                  {% set nthumb = product['thumb']|replace({' ': "%20"}) %}
                                                  {% set adres = constant('HTTP_SERVER') %}
                                                  {% set nthumb = nthumb|replace({adres: ""}) %}
                                                  {% set image_size = theme_options.getimagesize(nthumb) %}
                                                  {% set image_swap = theme_options.productImageSwap(product['product_id'], image_size[0], image_size[1]) %}
                                                  {% if (image_swap != '') %} {{ '<img src="' ~ image_swap ~ '" alt="' ~ product['name'] ~ '" class="swap-image" />' }}{% endif %}
                                             {% endif %} 
                                             {% if (theme_options.get( 'lazy_loading_images' ) != '0') %} 
                                             <img src="image/catalog/blank.gif" data-echo="{{ product['thumb'] }}" alt="{{ product['name'] }}" class="{% if (theme_options.get( 'product_image_effect' ) == '2') %} {{ 'zoom-image-effect' }} {% endif %}" />
                                             {% else %} 
                                             <img src="{{ product['thumb'] }}" alt="{{ product['name'] }}" class="{% if (theme_options.get( 'product_image_effect' ) == '2') %} {{ 'zoom-image-effect' }} {% endif %}" />
                                             {% endif %} 
                                        </a>
                                   </div>
                              {% else %} 
                                   <div class="image">
                                        <a href="{{ product['href'] }}"><img src="image/no_image.jpg" alt="{{ product['name'] }}" {% if (theme_options.get( 'product_image_effect' ) == '2') %} {{ 'class="zoom-image-effect"' }} {% endif %} /></a>
                                   </div>
                              {% endif %} 
                         </div>
                         <div class="right">
                              <div class="name"><a href="{{ product['href'] }}">{{ product['name'] }}</a></div>
                              <div class="price">
                                   {% if (not product['special']) %} 
                                   {{ product['price'] }} 
                                   {% else %} 
                                   <span class="price-old">{{ product['price'] }}</span> <span class="price-new">{{ product['special'] }}</span>
                                   {% endif %} 
                              </div>
                              {% if (theme_options.get( 'display_add_to_compare' ) != '0' or theme_options.get( 'display_add_to_wishlist' ) != '0' or theme_options.get( 'display_add_to_cart' ) != '0') %} 
                              <div class="only-hover">
                                   <ul>
                                        {% if (theme_options.get( 'display_add_to_cart' ) != '0') %} 
                                             <li><a onclick="cart.add('{{ product['product_id'] }}');" class="button-add-to-cart">{{ button_cart }}</a></li>
                                        {% endif %} 
                                        
                                        {% if (theme_options.get( 'quick_view' ) == 1) %} 
                                        <li class="quickview"><a href="index.php?route=product/quickview&product_id={{ product['product_id'] }}" data-toggle="tooltip" data-original-title="{% if (theme_options.get( 'quickview_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.html_entity_decode(theme_options.get( 'quickview_text', config.get( 'config_language_id' ) )) }} {% else %} {{ 'Quickview' }} {% endif %}"><i class="fa fa-search"></i></a></li>
                                        {% endif %} 
                                   
                                        {% if (theme_options.get( 'display_add_to_compare' ) != '0') %} 
                                        <li><a onclick="compare.add('{{ product['product_id'] }}');" data-toggle="tooltip" data-original-title="{% if (theme_options.get( 'add_to_compare_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'add_to_compare_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'Add to compare' }} {% endif %}"><i class="fa fa-exchange"></i></a></li>
                                        {% endif %} 
                                        
                                        {% if (theme_options.get( 'display_add_to_wishlist' ) != '0') %} 
                                        <li><a onclick="wishlist.add('{{ product['product_id'] }}');" data-toggle="tooltip" data-original-title="{% if (theme_options.get( 'add_to_wishlist_text', config.get( 'config_language_id' ) ) != '') %} {{ theme_options.get( 'add_to_wishlist_text', config.get( 'config_language_id' ) ) }} {% else %} {{ 'Add to wishlist' }} {% endif %}"><i class="fa fa-heart"></i></a></li>
                                        {% endif %} 
                                   </ul>
                              </div>
                              {% endif %} 
                         </div>
                    </div>
                {% endfor %}
                {{ '</div></div>' }}
          {{ '</div>' }}
     {{ '</div>' }}  
{% endif %}